<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>AWTK-CPP: TRichText类 参考</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">AWTK-CPP
   </div>
   <div id="projectbrief">AWTK CPP API</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'搜索','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public 成员函数</a> &#124;
<a href="#pub-static-methods">静态 Public 成员函数</a> &#124;
<a href="class_t_rich_text-members.html">所有成员列表</a>  </div>
  <div class="headertitle">
<div class="title">TRichText类 参考</div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="awtk__cpp_8hpp_source.html">awtk_cpp.hpp</a>&gt;</code></p>
<div class="dynheader">
类 TRichText 继承关系图:</div>
<div class="dyncontent">
 <div class="center">
  <img src="class_t_rich_text.png" alt=""/>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public 成员函数</h2></td></tr>
<tr class="memitem:a64cb0f05623fd876b9ad94ba97c65d2c"><td class="memItemLeft" align="right" valign="top"><a id="a64cb0f05623fd876b9ad94ba97c65d2c"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>TRichText</b> (widget_t *nativeObj)</td></tr>
<tr class="separator:a64cb0f05623fd876b9ad94ba97c65d2c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a897ae8e3a542c2a3d858e92fb1c711b5"><td class="memItemLeft" align="right" valign="top"><a id="a897ae8e3a542c2a3d858e92fb1c711b5"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>TRichText</b> (const rich_text_t *nativeObj)</td></tr>
<tr class="separator:a897ae8e3a542c2a3d858e92fb1c711b5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8fbcac28889e72b66a6a5a1aa5a6b0f1"><td class="memItemLeft" align="right" valign="top">ret_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_t_rich_text.html#a8fbcac28889e72b66a6a5a1aa5a6b0f1">SetText</a> (const char *text)</td></tr>
<tr class="separator:a8fbcac28889e72b66a6a5a1aa5a6b0f1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3d8a5d1ad2d21282ff20c36886cf4e56"><td class="memItemLeft" align="right" valign="top">ret_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_t_rich_text.html#a3d8a5d1ad2d21282ff20c36886cf4e56">SetYslidable</a> (bool yslidable)</td></tr>
<tr class="separator:a3d8a5d1ad2d21282ff20c36886cf4e56"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9775e7aec507f45264ea68c10d0d8552"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_t_rich_text.html#a9775e7aec507f45264ea68c10d0d8552">GetLineGap</a> () const</td></tr>
<tr class="separator:a9775e7aec507f45264ea68c10d0d8552"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af9765bbdf669dce9017f5d3f82a2baf6"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_t_rich_text.html#af9765bbdf669dce9017f5d3f82a2baf6">GetYslidable</a> () const</td></tr>
<tr class="separator:af9765bbdf669dce9017f5d3f82a2baf6"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
静态 Public 成员函数</h2></td></tr>
<tr class="memitem:a8010da23fa63797d13675e61ef2a1f3d"><td class="memItemLeft" align="right" valign="top"><a id="a8010da23fa63797d13675e61ef2a1f3d"></a>
static <a class="el" href="class_t_rich_text.html">TRichText</a>&#160;</td><td class="memItemRight" valign="bottom"><b>Cast</b> (widget_t *nativeObj)</td></tr>
<tr class="separator:a8010da23fa63797d13675e61ef2a1f3d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a91c11c1929cc331a81f955736c322940"><td class="memItemLeft" align="right" valign="top"><a id="a91c11c1929cc331a81f955736c322940"></a>
static <a class="el" href="class_t_rich_text.html">TRichText</a>&#160;</td><td class="memItemRight" valign="bottom"><b>Cast</b> (const widget_t *nativeObj)</td></tr>
<tr class="separator:a91c11c1929cc331a81f955736c322940"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aab140b3e9e2766b1a1f7405e19cefcc1"><td class="memItemLeft" align="right" valign="top"><a id="aab140b3e9e2766b1a1f7405e19cefcc1"></a>
static <a class="el" href="class_t_rich_text.html">TRichText</a>&#160;</td><td class="memItemRight" valign="bottom"><b>Cast</b> (TWidget &amp;obj)</td></tr>
<tr class="separator:aab140b3e9e2766b1a1f7405e19cefcc1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af351ffdfdc33c949a2ca0582220f27fe"><td class="memItemLeft" align="right" valign="top"><a id="af351ffdfdc33c949a2ca0582220f27fe"></a>
static <a class="el" href="class_t_rich_text.html">TRichText</a>&#160;</td><td class="memItemRight" valign="bottom"><b>Cast</b> (const TWidget &amp;obj)</td></tr>
<tr class="separator:af351ffdfdc33c949a2ca0582220f27fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4d1b8ca458377cca57aae4c354af162e"><td class="memItemLeft" align="right" valign="top">static TWidget&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_t_rich_text.html#a4d1b8ca458377cca57aae4c354af162e">Create</a> (TWidget &amp;parent, xy_t x, xy_t y, wh_t w, wh_t h)</td></tr>
<tr class="separator:a4d1b8ca458377cca57aae4c354af162e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">详细描述</h2>
<div class="textblock"><p>图文混排控件，实现简单的图文混排。</p>
<p>rich_text_t是widget\_t的子类控件，widget_t的函数均适用于rich_text_t控件。</p>
<p>在xml中使用"rich\_text"标签创建图文混排控件。如：</p>
<div class="fragment"><div class="line">*&lt;<span class="keywordtype">rich_text</span> <span class="keyword">x</span>=<span class="stringliteral">&quot;0&quot;</span> <span class="keyword">y</span>=<span class="stringliteral">&quot;0&quot;</span> <span class="keyword">w</span>=<span class="stringliteral">&quot;100%&quot;</span> <span class="keyword">h</span>=<span class="stringliteral">&quot;60&quot;</span></div>
<div class="line">*<span class="keyword">text</span>=&quot;&lt;<span class="keywordtype">image</span> <span class="keyword">name</span>=&amp;<span class="keyword">quota</span>;<span class="keyword">bricks</span>&amp;<span class="keyword">quota</span>;/&gt;&lt;<span class="keywordtype">font</span> <span class="keyword">align_v</span>=&amp;<span class="keyword">quota</span>;<span class="keyword">middle</span>&amp;<span class="keyword">quota</span>;&gt;<span class="keyword">hello</span> <span class="keyword">awtk</span>!&lt;/<span class="keywordtype">font</span>&gt;&quot; /&gt;</div>
</div><!-- fragment --> <blockquote class="doxtable">
<p></p>
</blockquote>
<blockquote class="doxtable">
<p>更多用法请参考： </p>
</blockquote>
<p><a href="https://github.com/zlgopen/awtk/blob/master/design/default/ui/rich_text.xml">rich_text.xml</a></p>
<p>在c代码中使用函数rich_text_create创建图文混排控件。如：</p>
<blockquote class="doxtable">
<p>完整示例请参考： </p>
</blockquote>
<p><a href="https://github.com/zlgopen/awtk-c-demos/blob/master/demos/rich_text.c">rich_text demo</a></p>
<p>可用通过style来设置控件的显示风格，如背景颜色等等。而字体的大小和颜色则由文本内部的属性决定。</p>
<p>目前支持image和font两个tag：</p>
<p>image 支持的属性有： name 图片的名称。 w 图片的宽度。 h 图片的高度。</p>
<p>font 支持的属性有： color 颜色。 size 大小。 align_v 垂直方向对齐的方式(top|middle|bottom)。 bold 粗体(暂不支持) italic 斜体(暂不支持) underline 下划线(暂不支持) </p>
</div><h2 class="groupheader">成员函数说明</h2>
<a id="a4d1b8ca458377cca57aae4c354af162e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4d1b8ca458377cca57aae4c354af162e">&#9670;&nbsp;</a></span>Create()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">TWidget TRichText::Create </td>
          <td>(</td>
          <td class="paramtype">TWidget &amp;&#160;</td>
          <td class="paramname"><em>parent</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">xy_t&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">xy_t&#160;</td>
          <td class="paramname"><em>y</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">wh_t&#160;</td>
          <td class="paramname"><em>w</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">wh_t&#160;</td>
          <td class="paramname"><em>h</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>创建rich_text对象</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">parent</td><td>父控件 </td></tr>
    <tr><td class="paramname">x</td><td>x坐标 </td></tr>
    <tr><td class="paramname">y</td><td>y坐标 </td></tr>
    <tr><td class="paramname">w</td><td>宽度 </td></tr>
    <tr><td class="paramname">h</td><td>高度</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>对象。 </dd></dl>

</div>
</div>
<a id="a9775e7aec507f45264ea68c10d0d8552"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9775e7aec507f45264ea68c10d0d8552">&#9670;&nbsp;</a></span>GetLineGap()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t TRichText::GetLineGap </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>行间距。 </p>

</div>
</div>
<a id="af9765bbdf669dce9017f5d3f82a2baf6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af9765bbdf669dce9017f5d3f82a2baf6">&#9670;&nbsp;</a></span>GetYslidable()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool TRichText::GetYslidable </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>标识控件是否允许上下拖动。 </p>

</div>
</div>
<a id="a8fbcac28889e72b66a6a5a1aa5a6b0f1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8fbcac28889e72b66a6a5a1aa5a6b0f1">&#9670;&nbsp;</a></span>SetText()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ret_t TRichText::SetText </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>text</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>设置文本。</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">text</td><td>文本。</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回RET_OK表示成功，否则表示失败。 </dd></dl>

</div>
</div>
<a id="a3d8a5d1ad2d21282ff20c36886cf4e56"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3d8a5d1ad2d21282ff20c36886cf4e56">&#9670;&nbsp;</a></span>SetYslidable()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ret_t TRichText::SetYslidable </td>
          <td>(</td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>yslidable</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>设置是否允许y方向滑动。</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">yslidable</td><td>是否允许滑动。</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>返回RET_OK表示成功，否则表示失败。 </dd></dl>

</div>
</div>
<hr/>该类的文档由以下文件生成:<ul>
<li>output/<a class="el" href="awtk__cpp_8hpp_source.html">awtk_cpp.hpp</a></li>
<li>output/awtk_cpp.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>
